#include <myheader.h>

/* Usage:  */
int main(int argc, char *argv[]){                                  
    ARGS_CHECK(argc,3);    
     int fd=open(argv[1],O_RDWR); 
    ERROR_CHECK(fd,-1,"open");
    //写在fd1里面
    int fd1=open(argv[2],O_RDWR);
    ERROR_CHECK(fd1,-1,"open");
    
    char buf[20]={0};
    while(1){
        lseek(fd,0,SEEK_SET);
        read(fd,buf,sizeof(buf)-1);
        printf("%s\n",buf);
        memset(buf,0,sizeof(buf));
        
        printf("B-------\n");
        read(0,buf,sizeof(buf)-1);
        write(fd1,buf,sizeof(buf));
        memset(buf,0,sizeof(buf));
    }
    
    
    return 0;
}

